
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class RankData{
  String rank;
  String area;
  String number;
  String compareYesterday;
  String compareLastMonth;
  RankData(this.rank,this.area,this.number,this.compareYesterday,this.compareLastMonth);
}


class RankClass extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Container();
  }
}

  List<RankData> rankDatas = [
    RankData("01", "南区", "40", "40", "40"),
    RankData("02", "北区", "100", "100", "40"),
    RankData("03", "中区", "60", "60", "40"),
    RankData("04", "西区", "70", "70", "100"),
    RankData("05", "东区", "80", "80", "40"),
    RankData("06", "中区", "60", "60", "40"),
    RankData("07", "西区", "70", "70", "40"),
    RankData("08", "东区", "80", "80", "100"),
    RankData("09", "东区", "80", "80", "40"),
    RankData("10", "北区", "80", "80", "40"),
  ];

  Widget rankItem(RankData data) {
    return Row(
      mainAxisAlignment: MainAxisAlignment.spaceAround,
      children: <Widget>[
        labelWith(data.rank),
        labelWith(data.area),
        labelWith(data.number),
        labelWith(data.compareYesterday),
        labelWith(data.compareLastMonth),
      ],
    );
  }


  Widget rankTitle(BuildContext context) {
    double width = (MediaQuery.of(context).size.width  - 30)/5.0;
    return Row(
      mainAxisAlignment: MainAxisAlignment.spaceAround,
      children: <Widget>[
        titleLabelWith("排名",width),
        titleLabelWith("机构",width),
        titleCompareLabelWith("存款余额",width),
        titleCompareLabelWith("比上日",width),
        titleCompareLabelWith("比上月",width),
      ],
    );
  }

  Widget titleLabelWith(String string,double width) {
    return Container(
      width: width,
      height: 37,
//      color: Colors.red,
      child: Center(
        child: Text(
            string, style: TextStyle(fontSize: 14.0, color: Color(0xFF7981A0))),
      ),
    );
  }

  Widget titleCompareLabelWith(String string,double width) {
    return Container(
      width: width,
      height: 45,
//      color: Colors.red,
      child: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(string,
                style: TextStyle(fontSize: 14.0, color: Color(0xFF7981A0))),
            Text("(亿)", style: TextStyle(fontSize: 14.0, color: Color(0xFF7981A0)))
          ],
        ),
      ),
    );
  }

  Widget labelWith(String string) {
    return Container(
      width: 40,
      height: 37,
//    color: Colors.red,
      child: Center(
        child: Text(
            string, style: TextStyle(fontSize: 14.0, color: Colors.white70)),
      ),
    );
  }
